<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <link rel="stylesheet" href="helpwin.css">
      <title>MATLAB File Help: visgraph</title>
   </head>
   <body>
      <!--Single-page help-->
      <table border="0" cellspacing="0" width="100%">
         <tr class="subheader">
            <td class="headertitle">MATLAB File Help: visgraph</td>
            <td class="subheader-left"><a href="visgraph.m">View code for visgraph</a></td>
            <td class="subheader-right"><a href="Contents.html">WFDB Contents</a></td>
         </tr>
      </table>
      <div class="title">visgraph</div>
      <div class="helptext"><pre><!--helptext -->


function varargout=visgraph(varargin)

 [k,logP]=visgraph(x)

 Visibility Graph analysis of a time series as described in:
 
 Lacasa, Lucas, et al. 
 "From time series to complex networks: The visibility graph." 
  Proceedings of the National Academy of Sciences 105.13 (2008): 4972-4975.

 Required input parameter:
 x
       Nx1 matrix (doubles) of time series to be analyzed.



 Written by Ikaro Silva, 20134
 Last Modified: November 24, 2014
 Version 1.0

 Since 0.9.8


 %Example
 %Generate Conway Series
 N=1000;
 a=ones(N,1);
 out=ones(N,1);
 for n=3:N
     a(n)=a(a(n-1))+ a(n-a(n-1));
     out(n)= a(n) - (n/2);
 end
 
 %Generate Surrogate Data
 nS=5;
 S=surrogate(out,nS);
 subplot(3,1,1)
 plot(out);title('Conway Series')
 subplot(3,1,2)
 plot(S(:,1),'r');title('Amplitude Adjusted Surrogate Data')
 
 %Calculate visibility graph for all series
 [k,logP]=visgraph(out);
 subplot(3,1,3)
 plot(k,logP);hold on;grid on
 
 for n=1:nS
     [k,logP]=visgraph(S(:,n));
     subplot(3,1,3)
     plot(k,logP,'r');
 end

 See also SURROGATE, DFA, MSENTROPY, CORRINT
</pre></div><!--after help -->
   </body>
</html>
